from django.conf.urls import url
from rest_framework.routers import DefaultRouter

from question.views import RespondViewSet
from . import views
from rest_framework import routers
urlpatterns = [
    url(r'^question/(?P<label_id>\d+)/$', views.TroublesView.as_view()),
    url(r'^navigation_label/$', views.NavigationLabelView.as_view()),
    url(r'^hot_label/$', views.HotLabelView.as_view()),
    url(r'^question/detail/(?P<pk>\d+)/$', views.TroublesDetailView.as_view()),
    # url(r'^answer/(?P<pk>\d+)/$', views.RespondViewSet.as_view({'get': 'list'})),
    # url(r'^answer/(?P<pk>\d+)/$', views.RespondViewSet.as_view({'post': 'create'})),
    url(r'^comment/(?P<pk>\d+)/$', views.CommentView.as_view()),
    url(r'question/like/$', views.TroublesLikeView.as_view()),
    url(r'question/cancel_like/$', views.TroublesCancelLikeView.as_view()),
#     url(r'label_submit/$', views.LabelLikeView.as_view()),
]


# 可以处理视图的路由器
router = DefaultRouter()
# 向路由器中注册视图集
router.register(r'^answer/(?P<pk>\d+)', RespondViewSet, base_name='respond')
# 将路由器中的所以路由信息追到到django的路由列表中
urlpatterns += router.urls